<!--
 * createor: zc
 * email: zc8023zs@163.com
 * create_time: 2020/3/14 13:46:24
 *-->
<template>
  <el-container>
    <el-header style="margin:20px 10px 0 10px;height:auto">
      <el-form :inline="true" :model="listQuery">
        <el-form-item>
          <el-button type="primary" icon="el-icon-edit" @click="onAdd">{{$t('table.add')}}</el-button>
        </el-form-item> 
      </el-form>
    </el-header>
    <el-main>
      <el-table
        :key="tableKey"
        :data="listData" :height="tableHeight"
        highlight-current-row border fit
        v-loading="tabLoading"
      >
        <el-table-column type="index" label=" " width="50" align="center" :index="table_index" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="id" label="编号" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="user_name" label="用户名" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="mobile" label="手机号" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="login_pass" label="登录密码" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="mobile_check" label="1已验证 0未验证(默认)" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="email" label="邮箱" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="email_check" label="1已验证 0未验证(默认)" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="score" label="可用积分" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="score_total" label="累计积分" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="amount" label="账户余额" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="pay_pass" label="余额支付密码" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="alias" label="会员昵称" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="sex" label="0保密(默认) 1男 2女" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="birthday" label="生日" width="120" align="center" :formatter="dateFormat" :show-overflow-tooltip="true"/>
        <el-table-column prop="qq" label="QQ号" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="reg_date" label="注册日期" width="120" align="center" :formatter="dateFormat" :show-overflow-tooltip="true"/>
        <el-table-column prop="reg_source" label="0后台添加(默认)                        1网站                        2APP                        3微信端                        4小程序" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="note" label="管理备注" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="isok" label="1正常 0禁用" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="img_url" label="头像" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="qq_id" label="QQ openid" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="qq_name" label="QQ昵称" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="qq_img_url" label="" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="wx_id" label="微信openid" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="wx_name" label="微信昵称" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="wx_img_url" label="微信图像地址" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="xcx_id" label="小程序openid" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="xcx_formid" label="用于推送模板消息" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="union_id" label="微信开放平台union_id" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="grade_id" label="会员等级" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="start_time" label="等级开始时间" width="120" align="center" :formatter="dateFormat" :show-overflow-tooltip="true"/>
        <el-table-column prop="due_time" label="等级到期时间" width="120" align="center" :formatter="dateFormat" :show-overflow-tooltip="true"/>
        <el-table-column prop="invite_code" label="推荐码" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="parent_id" label="上级ID" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="parent_parent_id" label="上上级ID" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="user_type" label="1普通用户                        2团长                        3区域合伙人" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="is_trial" label="是否试用团长/合伙人 0否 1是" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="operator_id" label="运营商ID" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="self_mention_point" label="自提点" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="total_sales_amount" label="团长销售总金额" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="team_sales_amount" label="团队销售总金额" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="total_commission" label="总佣金" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="available_commission" label="可提现佣金" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="used_commission" label="累计已提现佣金" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="pending_commission" label="待结算佣金" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="freeze_commission" label="冻结佣金" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="encrypt_key" label="可提现金额校验key" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="province_id" label="所属省份" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="regimental_qr_code" label="团长微信二维码" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="regimental_desc" label="团长简介" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="regimental_atlas" label="团长图集" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="last_login_time" label="最后登录时间" width="120" align="center" :formatter="dateFormat" :show-overflow-tooltip="true"/>
        <el-table-column prop="last_login_ip" label="最后登录IP" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="last_buy_time" label="最后购买时间" width="120" align="center" :formatter="dateFormat" :show-overflow-tooltip="true"/>
        <el-table-column prop="up_time" label="升级时间" width="120" align="center" :formatter="dateFormat" :show-overflow-tooltip="true"/>
        <el-table-column prop="is_verificationer" label="是否核销员 0：否，1：" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="is_authentication" label="是否实名认证 0 否 1是" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="live_player_type" label="主播类型 0非主播 1常驻主播 2临时主播" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="is_official_live_player" label="是否官方主播0 否 1是" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="live_player_status" label="主播状态 0禁用 1启用" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="live_player_name" label="主播昵称，唯一" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="live_player_wx_account" label="主播微信账号" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="live_player_fans_num" label="粉丝数量" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="live_player_open_time" label="开通时间" width="120" align="center" :formatter="dateFormat" :show-overflow-tooltip="true"/>
        <el-table-column prop="live_player_remarks" label="直播备注" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="is_syxhz" label="是否推送十堰会员系统，0否 1是 默认0" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column
          :label="$t('table.actions')"
          align="left"
          min-width="230"
          class-name="small-padding fixed-width"
        >
          <template slot-scope="scope">
            <el-dropdown @command="onInfoPages">
              <span class="el-dropdown-link">
                <i class="el-icon-s-tools el-icon--left"></i>功能操作<i class="el-icon-arrow-down el-icon--right"></i>
              </span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item icon="el-icon-edit" :command="{a:scope,b:'edit'}">{{$t('table.edit')}}</el-dropdown-item> 
                <el-dropdown-item icon="el-icon-search" :command="{a:scope,b:'info'}">{{$t('table.info')}}</el-dropdown-item> 
                <el-dropdown-item icon="el-icon-delete" :command="{a:scope,b:'delete'}">{{$t('table.delete')}}</el-dropdown-item> 
              </el-dropdown-menu>
            </el-dropdown>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        v-show="pagecnt>1"
        :total="total"
        :page.sync="listQuery.page"
        :limit.sync="listQuery.size"
        @pagination="getList"
      />
    <el-dialog :title="dialogTitle" :visible.sync="dialogFormVisible">
      <el-form ref="dataForm" :model="formData" label-width="200px" style="padding:5% 5% 0 5%">
        <el-form-item label="编号：">
          <el-input v-model="formData.id" placeholder="请输入编号"></el-input>
        </el-form-item>
        <el-form-item label="用户名：">
          <el-input v-model="formData.user_name" placeholder="请输入用户名"></el-input>
        </el-form-item>
        <el-form-item label="手机号：">
          <el-input v-model="formData.mobile" placeholder="请输入手机号"></el-input>
        </el-form-item>
        <el-form-item label="登录密码：">
          <el-input v-model="formData.login_pass" placeholder="请输入登录密码"></el-input>
        </el-form-item>
        <el-form-item label="1已验证 0未验证(默认)：">
          <el-input v-model="formData.mobile_check" placeholder="请输入1已验证 0未验证(默认)"></el-input>
        </el-form-item>
        <el-form-item label="邮箱：">
          <el-input v-model="formData.email" placeholder="请输入邮箱"></el-input>
        </el-form-item>
        <el-form-item label="1已验证 0未验证(默认)：">
          <el-input v-model="formData.email_check" placeholder="请输入1已验证 0未验证(默认)"></el-input>
        </el-form-item>
        <el-form-item label="可用积分：">
          <el-input v-model="formData.score" placeholder="请输入可用积分"></el-input>
        </el-form-item>
        <el-form-item label="累计积分：">
          <el-input v-model="formData.score_total" placeholder="请输入累计积分"></el-input>
        </el-form-item>
        <el-form-item label="账户余额：">
          <el-input v-model="formData.amount" placeholder="请输入账户余额"></el-input>
        </el-form-item>
        <el-form-item label="余额支付密码：">
          <el-input v-model="formData.pay_pass" placeholder="请输入余额支付密码"></el-input>
        </el-form-item>
        <el-form-item label="会员昵称：">
          <el-input v-model="formData.alias" placeholder="请输入会员昵称"></el-input>
        </el-form-item>
        <el-form-item label="0保密(默认) 1男 2女：">
          <el-input v-model="formData.sex" placeholder="请输入0保密(默认) 1男 2女"></el-input>
        </el-form-item>
        <el-form-item label="生日：">
          <el-input v-model="formData.birthday" placeholder="请输入生日"></el-input>
        </el-form-item>
        <el-form-item label="QQ号：">
          <el-input v-model="formData.qq" placeholder="请输入QQ号"></el-input>
        </el-form-item>
        <el-form-item label="注册日期：">
          <el-input v-model="formData.reg_date" placeholder="请输入注册日期"></el-input>
        </el-form-item>
        <el-form-item label="0后台添加(默认)                        1网站                        2APP                        3微信端                        4小程序：">
          <el-input v-model="formData.reg_source" placeholder="请输入0后台添加(默认)                        1网站                        2APP                        3微信端                        4小程序"></el-input>
        </el-form-item>
        <el-form-item label="管理备注：">
          <el-input v-model="formData.note" placeholder="请输入管理备注"></el-input>
        </el-form-item>
        <el-form-item label="1正常 0禁用：">
          <el-input v-model="formData.isok" placeholder="请输入1正常 0禁用"></el-input>
        </el-form-item>
        <el-form-item label="头像：">
          <el-input v-model="formData.img_url" placeholder="请输入头像"></el-input>
        </el-form-item>
        <el-form-item label="QQ openid：">
          <el-input v-model="formData.qq_id" placeholder="请输入QQ openid"></el-input>
        </el-form-item>
        <el-form-item label="QQ昵称：">
          <el-input v-model="formData.qq_name" placeholder="请输入QQ昵称"></el-input>
        </el-form-item>
        <el-form-item label="：">
          <el-input v-model="formData.qq_img_url" placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="微信openid：">
          <el-input v-model="formData.wx_id" placeholder="请输入微信openid"></el-input>
        </el-form-item>
        <el-form-item label="微信昵称：">
          <el-input v-model="formData.wx_name" placeholder="请输入微信昵称"></el-input>
        </el-form-item>
        <el-form-item label="微信图像地址：">
          <el-input v-model="formData.wx_img_url" placeholder="请输入微信图像地址"></el-input>
        </el-form-item>
        <el-form-item label="小程序openid：">
          <el-input v-model="formData.xcx_id" placeholder="请输入小程序openid"></el-input>
        </el-form-item>
        <el-form-item label="用于推送模板消息：">
          <el-input v-model="formData.xcx_formid" placeholder="请输入用于推送模板消息"></el-input>
        </el-form-item>
        <el-form-item label="微信开放平台union_id：">
          <el-input v-model="formData.union_id" placeholder="请输入微信开放平台union_id"></el-input>
        </el-form-item>
        <el-form-item label="会员等级：">
          <el-input v-model="formData.grade_id" placeholder="请输入会员等级"></el-input>
        </el-form-item>
        <el-form-item label="等级开始时间：">
          <el-input v-model="formData.start_time" placeholder="请输入等级开始时间"></el-input>
        </el-form-item>
        <el-form-item label="等级到期时间：">
          <el-input v-model="formData.due_time" placeholder="请输入等级到期时间"></el-input>
        </el-form-item>
        <el-form-item label="推荐码：">
          <el-input v-model="formData.invite_code" placeholder="请输入推荐码"></el-input>
        </el-form-item>
        <el-form-item label="上级ID：">
          <el-input v-model="formData.parent_id" placeholder="请输入上级ID"></el-input>
        </el-form-item>
        <el-form-item label="上上级ID：">
          <el-input v-model="formData.parent_parent_id" placeholder="请输入上上级ID"></el-input>
        </el-form-item>
        <el-form-item label="1普通用户                        2团长                        3区域合伙人：">
          <el-input v-model="formData.user_type" placeholder="请输入1普通用户                        2团长                        3区域合伙人"></el-input>
        </el-form-item>
        <el-form-item label="是否试用团长/合伙人 0否 1是：">
          <el-input v-model="formData.is_trial" placeholder="请输入是否试用团长/合伙人 0否 1是"></el-input>
        </el-form-item>
        <el-form-item label="运营商ID：">
          <el-input v-model="formData.operator_id" placeholder="请输入运营商ID"></el-input>
        </el-form-item>
        <el-form-item label="自提点：">
          <el-input v-model="formData.self_mention_point" placeholder="请输入自提点"></el-input>
        </el-form-item>
        <el-form-item label="团长销售总金额：">
          <el-input v-model="formData.total_sales_amount" placeholder="请输入团长销售总金额"></el-input>
        </el-form-item>
        <el-form-item label="团队销售总金额：">
          <el-input v-model="formData.team_sales_amount" placeholder="请输入团队销售总金额"></el-input>
        </el-form-item>
        <el-form-item label="总佣金：">
          <el-input v-model="formData.total_commission" placeholder="请输入总佣金"></el-input>
        </el-form-item>
        <el-form-item label="可提现佣金：">
          <el-input v-model="formData.available_commission" placeholder="请输入可提现佣金"></el-input>
        </el-form-item>
        <el-form-item label="累计已提现佣金：">
          <el-input v-model="formData.used_commission" placeholder="请输入累计已提现佣金"></el-input>
        </el-form-item>
        <el-form-item label="待结算佣金：">
          <el-input v-model="formData.pending_commission" placeholder="请输入待结算佣金"></el-input>
        </el-form-item>
        <el-form-item label="冻结佣金：">
          <el-input v-model="formData.freeze_commission" placeholder="请输入冻结佣金"></el-input>
        </el-form-item>
        <el-form-item label="可提现金额校验key：">
          <el-input v-model="formData.encrypt_key" placeholder="请输入可提现金额校验key"></el-input>
        </el-form-item>
        <el-form-item label="所属省份：">
          <el-input v-model="formData.province_id" placeholder="请输入所属省份"></el-input>
        </el-form-item>
        <el-form-item label="团长微信二维码：">
          <el-input v-model="formData.regimental_qr_code" placeholder="请输入团长微信二维码"></el-input>
        </el-form-item>
        <el-form-item label="团长简介：">
          <el-input v-model="formData.regimental_desc" placeholder="请输入团长简介"></el-input>
        </el-form-item>
        <el-form-item label="团长图集：">
          <el-input v-model="formData.regimental_atlas" placeholder="请输入团长图集"></el-input>
        </el-form-item>
        <el-form-item label="最后登录时间：">
          <el-input v-model="formData.last_login_time" placeholder="请输入最后登录时间"></el-input>
        </el-form-item>
        <el-form-item label="最后登录IP：">
          <el-input v-model="formData.last_login_ip" placeholder="请输入最后登录IP"></el-input>
        </el-form-item>
        <el-form-item label="最后购买时间：">
          <el-input v-model="formData.last_buy_time" placeholder="请输入最后购买时间"></el-input>
        </el-form-item>
        <el-form-item label="升级时间：">
          <el-input v-model="formData.up_time" placeholder="请输入升级时间"></el-input>
        </el-form-item>
        <el-form-item label="是否核销员 0：否，1：：">
          <el-input v-model="formData.is_verificationer" placeholder="请输入是否核销员 0：否，1："></el-input>
        </el-form-item>
        <el-form-item label="是否实名认证 0 否 1是：">
          <el-input v-model="formData.is_authentication" placeholder="请输入是否实名认证 0 否 1是"></el-input>
        </el-form-item>
        <el-form-item label="主播类型 0非主播 1常驻主播 2临时主播：">
          <el-input v-model="formData.live_player_type" placeholder="请输入主播类型 0非主播 1常驻主播 2临时主播"></el-input>
        </el-form-item>
        <el-form-item label="是否官方主播0 否 1是：">
          <el-input v-model="formData.is_official_live_player" placeholder="请输入是否官方主播0 否 1是"></el-input>
        </el-form-item>
        <el-form-item label="主播状态 0禁用 1启用：">
          <el-input v-model="formData.live_player_status" placeholder="请输入主播状态 0禁用 1启用"></el-input>
        </el-form-item>
        <el-form-item label="主播昵称，唯一：">
          <el-input v-model="formData.live_player_name" placeholder="请输入主播昵称，唯一"></el-input>
        </el-form-item>
        <el-form-item label="主播微信账号：">
          <el-input v-model="formData.live_player_wx_account" placeholder="请输入主播微信账号"></el-input>
        </el-form-item>
        <el-form-item label="粉丝数量：">
          <el-input v-model="formData.live_player_fans_num" placeholder="请输入粉丝数量"></el-input>
        </el-form-item>
        <el-form-item label="开通时间：">
          <el-input v-model="formData.live_player_open_time" placeholder="请输入开通时间"></el-input>
        </el-form-item>
        <el-form-item label="直播备注：">
          <el-input v-model="formData.live_player_remarks" placeholder="请输入直播备注"></el-input>
        </el-form-item>
        <el-form-item label="是否推送十堰会员系统，0否 1是 默认0：">
          <el-input v-model="formData.is_syxhz" placeholder="请输入是否推送十堰会员系统，0否 1是 默认0"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
          <el-button
            type="primary"
            v-if="curdAction=='update' || curdAction=='add'"
            @click="onSave"
            :loading="saveLoading" v-text="$t('table.save')"
          ></el-button> 
        <el-button @click="dialogFormVisible = false">取 消</el-button>
      </div>
    </el-dialog>

    </el-main>
  </el-container>
</template>
<style scoped>
body .app-container .el-container,
body .app-container .el-header,
body .app-container .el-main,
body .el-container,
body .el-header,
body .el-main {
  padding: 0;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}
</style>
<script>
import Pagination from "@/components/Pagination";
import { Loading } from "element-ui";
import {
  jbr_usersSelecttree,
  jbr_usersSelectpage,
  jbr_usersSelect,
  jbr_usersAdd,
  jbr_usersUpdate,
  jbr_usersDel,
  jbr_usersInfo
} from '@/api/project/wmyh/project_wmyh_jbr_users'
export default {
  name: "a_wmyha_jbr_users",
  components: { Pagination, },
  filters: {},
  data() {
    return {
      dialogTitle: `会员表编辑`,
      curdAction: "",
      saveLoading: false,
      delLoading: false,
      tabLoading: false,
      dialogFormVisible: false,
      tableKey: 'wmyh_jbr_users_table',
      listData: null,
      total: 0,
      pagecnt: 0,
      tableHeight: (window.innerHeight-100),
      listQuery: {
        page: 1,
        size: 20,
      },
      formData: {
        id: null, 
        user_name: null, 
        mobile: null, 
        login_pass: null, 
        mobile_check: null, 
        email: null, 
        email_check: null, 
        score: null, 
        score_total: null, 
        amount: null, 
        pay_pass: null, 
        alias: null, 
        sex: null, 
        birthday: null, 
        qq: null, 
        reg_date: null, 
        reg_source: null, 
        note: null, 
        isok: null, 
        img_url: null, 
        qq_id: null, 
        qq_name: null, 
        qq_img_url: null, 
        wx_id: null, 
        wx_name: null, 
        wx_img_url: null, 
        xcx_id: null, 
        xcx_formid: null, 
        union_id: null, 
        grade_id: null, 
        start_time: null, 
        due_time: null, 
        invite_code: null, 
        parent_id: null, 
        parent_parent_id: null, 
        user_type: null, 
        is_trial: null, 
        operator_id: null, 
        self_mention_point: null, 
        total_sales_amount: null, 
        team_sales_amount: null, 
        total_commission: null, 
        available_commission: null, 
        used_commission: null, 
        pending_commission: null, 
        freeze_commission: null, 
        encrypt_key: null, 
        province_id: null, 
        regimental_qr_code: null, 
        regimental_desc: null, 
        regimental_atlas: null, 
        last_login_time: null, 
        last_login_ip: null, 
        last_buy_time: null, 
        up_time: null, 
        is_verificationer: null, 
        is_authentication: null, 
        live_player_type: null, 
        is_official_live_player: null, 
        live_player_status: null, 
        live_player_name: null, 
        live_player_wx_account: null, 
        live_player_fans_num: null, 
        live_player_open_time: null, 
        live_player_remarks: null, 
        is_syxhz: null, 
      },
    };
  },
  mounted(){
    let that =this;
    window.onresize=()=>{
      this.tableHeight = (window.innerHeight-100);
    }
  },
  created() {
    this.getList();
  },
  methods: {
    onSearch(command){
      if(command && command=='all'){
        this.resetQuery();
      }
      this.listQuery.page=1;
      this.getList();
    },
    onInfoPage(scope){
      var view = this.$store.state.permission.routesMap["/wmyh/jbr_users_info"];
      this.$router.push({ path: view.path, query: {m_id:view.code_aes,id:scope.row.id} })
    },
    onInfoPages(commend){
      if(commend.b=='edit')this.onEdit(commend.a);
      if(commend.b=='info')this.onInfoPage(commend.a);
      if(commend.b=='delete')this.onDel(commend.a);
    },
    reset(){
      this.formData = {
        id: null, 
        user_name: null, 
        mobile: null, 
        login_pass: null, 
        mobile_check: null, 
        email: null, 
        email_check: null, 
        score: null, 
        score_total: null, 
        amount: null, 
        pay_pass: null, 
        alias: null, 
        sex: null, 
        birthday: null, 
        qq: null, 
        reg_date: null, 
        reg_source: null, 
        note: null, 
        isok: null, 
        img_url: null, 
        qq_id: null, 
        qq_name: null, 
        qq_img_url: null, 
        wx_id: null, 
        wx_name: null, 
        wx_img_url: null, 
        xcx_id: null, 
        xcx_formid: null, 
        union_id: null, 
        grade_id: null, 
        start_time: null, 
        due_time: null, 
        invite_code: null, 
        parent_id: null, 
        parent_parent_id: null, 
        user_type: null, 
        is_trial: null, 
        operator_id: null, 
        self_mention_point: null, 
        total_sales_amount: null, 
        team_sales_amount: null, 
        total_commission: null, 
        available_commission: null, 
        used_commission: null, 
        pending_commission: null, 
        freeze_commission: null, 
        encrypt_key: null, 
        province_id: null, 
        regimental_qr_code: null, 
        regimental_desc: null, 
        regimental_atlas: null, 
        last_login_time: null, 
        last_login_ip: null, 
        last_buy_time: null, 
        up_time: null, 
        is_verificationer: null, 
        is_authentication: null, 
        live_player_type: null, 
        is_official_live_player: null, 
        live_player_status: null, 
        live_player_name: null, 
        live_player_wx_account: null, 
        live_player_fans_num: null, 
        live_player_open_time: null, 
        live_player_remarks: null, 
        is_syxhz: null, 
      };
    },
    onAdd(){
      this.dialogFormVisible=true;
      this.curdAction = "add";
      this.dialogTitle=`会员表添加`;
      this.reset();
    },
    onEdit(data){
      this.onInfo(data);
      this.dialogFormVisible=true;
      this.curdAction = "update";
      this.dialogTitle=`会员表编辑`;
      this.reset();
    },
    onSave(){
      this.$refs["dataForm"].validate(valid => {
        if (valid) {
          this.saveLoading = true;
          if (this.curdAction == "add") {
            jbr_usersAdd(this.$qs.stringify(this.formData)).then(r => {
                this.getList();
                this.reset();
                this.curdAction = '';
                this.saveLoading  = false;
                this.dialogFormVisible = false
            }).catch(()=>{
              this.saveLoading=false;
            });
          } else if (this.curdAction == "update") {
            jbr_usersUpdate(this.$qs.stringify(this.formData)).then(r => {
                this.getList();
                this.reset();
                this.curdAction = '';
                this.saveLoading  = false;
                this.dialogFormVisible = false
            }).catch(()=>{
              this.saveLoading=false;
            });
          }
        }
      });
    },
    onDel(data){
        var that = this;
        this.$confirm('确定删除?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
        }).then(() => {
            jbr_usersDel(that.$qs.stringify({id:data.row.id})).then(r=>{
                that.getList();
                that.reset();
                that.curdAction = '';
                that.delLoading  = false;
                that.$notify({
                    message:"删除成功",
                    type: "success"
                });
            }); 
        }).catch(() => {
            this.$notify({
                message: "已取消删除",
                type: "info"
            }); 
        });
    },
    onInfo(data){
        jbr_usersInfo({id:data.row.id}).then(r=>{
            this.formData.id=r.dataSingle.id;
            this.formData.user_name=r.dataSingle.user_name;
            this.formData.mobile=r.dataSingle.mobile;
            this.formData.login_pass=r.dataSingle.login_pass;
            this.formData.mobile_check=r.dataSingle.mobile_check;
            this.formData.email=r.dataSingle.email;
            this.formData.email_check=r.dataSingle.email_check;
            this.formData.score=r.dataSingle.score;
            this.formData.score_total=r.dataSingle.score_total;
            this.formData.amount=r.dataSingle.amount;
            this.formData.pay_pass=r.dataSingle.pay_pass;
            this.formData.alias=r.dataSingle.alias;
            this.formData.sex=r.dataSingle.sex;
            this.formData.birthday=r.dataSingle.birthday;
            this.formData.qq=r.dataSingle.qq;
            this.formData.reg_date=r.dataSingle.reg_date;
            this.formData.reg_source=r.dataSingle.reg_source;
            this.formData.note=r.dataSingle.note;
            this.formData.isok=r.dataSingle.isok;
            this.formData.img_url=r.dataSingle.img_url;
            this.formData.qq_id=r.dataSingle.qq_id;
            this.formData.qq_name=r.dataSingle.qq_name;
            this.formData.qq_img_url=r.dataSingle.qq_img_url;
            this.formData.wx_id=r.dataSingle.wx_id;
            this.formData.wx_name=r.dataSingle.wx_name;
            this.formData.wx_img_url=r.dataSingle.wx_img_url;
            this.formData.xcx_id=r.dataSingle.xcx_id;
            this.formData.xcx_formid=r.dataSingle.xcx_formid;
            this.formData.union_id=r.dataSingle.union_id;
            this.formData.grade_id=r.dataSingle.grade_id;
            this.formData.start_time=r.dataSingle.start_time;
            this.formData.due_time=r.dataSingle.due_time;
            this.formData.invite_code=r.dataSingle.invite_code;
            this.formData.parent_id=r.dataSingle.parent_id;
            this.formData.parent_parent_id=r.dataSingle.parent_parent_id;
            this.formData.user_type=r.dataSingle.user_type;
            this.formData.is_trial=r.dataSingle.is_trial;
            this.formData.operator_id=r.dataSingle.operator_id;
            this.formData.self_mention_point=r.dataSingle.self_mention_point;
            this.formData.total_sales_amount=r.dataSingle.total_sales_amount;
            this.formData.team_sales_amount=r.dataSingle.team_sales_amount;
            this.formData.total_commission=r.dataSingle.total_commission;
            this.formData.available_commission=r.dataSingle.available_commission;
            this.formData.used_commission=r.dataSingle.used_commission;
            this.formData.pending_commission=r.dataSingle.pending_commission;
            this.formData.freeze_commission=r.dataSingle.freeze_commission;
            this.formData.encrypt_key=r.dataSingle.encrypt_key;
            this.formData.province_id=r.dataSingle.province_id;
            this.formData.regimental_qr_code=r.dataSingle.regimental_qr_code;
            this.formData.regimental_desc=r.dataSingle.regimental_desc;
            this.formData.regimental_atlas=r.dataSingle.regimental_atlas;
            this.formData.last_login_time=r.dataSingle.last_login_time;
            this.formData.last_login_ip=r.dataSingle.last_login_ip;
            this.formData.last_buy_time=r.dataSingle.last_buy_time;
            this.formData.up_time=r.dataSingle.up_time;
            this.formData.is_verificationer=r.dataSingle.is_verificationer;
            this.formData.is_authentication=r.dataSingle.is_authentication;
            this.formData.live_player_type=r.dataSingle.live_player_type;
            this.formData.is_official_live_player=r.dataSingle.is_official_live_player;
            this.formData.live_player_status=r.dataSingle.live_player_status;
            this.formData.live_player_name=r.dataSingle.live_player_name;
            this.formData.live_player_wx_account=r.dataSingle.live_player_wx_account;
            this.formData.live_player_fans_num=r.dataSingle.live_player_fans_num;
            this.formData.live_player_open_time=r.dataSingle.live_player_open_time;
            this.formData.live_player_remarks=r.dataSingle.live_player_remarks;
            this.formData.is_syxhz=r.dataSingle.is_syxhz;
        });
    },
    dateFormat(row, column, cellValue, index){
      return this.$moment(cellValue).format("YYYY/MM/DD");
    }, 
    commentFormat(row, column, cellValue, index){
      try {
        var comment = "";
        var array = comment.split(':')[1].split(' ');
        var obj = {};
        for(var i=0;i<array.length;i++){
          var split = array[i].split('=');
          obj[split[1]]=split[0];
        }
        if(obj[cellValue]) return obj[cellValue];
        return cellValue;
      } catch (error) {
        return cellValue;
      }
    },
    table_index(index) {
      return (this.listQuery.page - 1) * this.listQuery.size + index + 1;
    },
    getList() {
      this.tabLoading=true;
      jbr_usersSelectpage(this.$qs.stringify(this.listQuery,{ indices: false })).then(r=>{
        this.listData = r.dataArray.dataList;
        this.total = r.dataArray.dataCount;
        this.pagecnt = r.dataArray.pageCount;
        this.tabLoading=false;
      }).catch(()=>{
        this.tabLoading=false;
      });
    }
  }
};
</script>